[Home]
Fontconfig Crap
Okay, this is not a well-written section. It's more of a gripe-file for my experience trying to get fontconfig to do what I want it to.
If you're a MacOS, Windows, Android, or iOS user, this page will be utterly useless to you, so... feel free to move on now. But, if you're on a *nix sytem, maybe something here will be illuminating.
It should be possible to make fontconfig mask-out a certain range of codepoints in one font and have it use another font in its place. I haven't been able to get this to work yet. I'm partially there, but I don't have the necessary knowledge to finish the job.
Okay, here's an example scenario: let's say that I really like to use IosevkaTerm in my console, but I want my console to use IBM 3270 Condensed for box-drawing and graphics characters. If I put something like this in my fonts.conf...
<match target="font">
<test name="family" compare="eq">
<string>IosevkaTerm</string>
</test>
<edit name="charset" mode="assign">
<minus>
<charset>
<range>
<int>0x2580</int>
<int>0x259F</int>
</range>
</charset>
</minus>
</edit>
</match>
...what that'll do is it'll basically remove the Block Elements (codepoints U+2580 through U+259F) from Iosevka. And... it works in xterm and dmenu and stuff, but I can't figure out how to set a working fallback font, so I just get tofu for the masked-out codepoints.
Setting fallbacks is usually done like this:
<alias>
<!-- set Unifont Upper as the fallback for Unifont -->
<family>Unifont</family>
<prefer>
<family>Unifont</family>
<!-- fallbacks go below -->
<family>Unifont Upper</family>
<!-- ... -->
</prefer>
</alias>
But if I set a fallback for Iosevka in the same way, it doesn't work with the <minus><charset> method above. I just get tofu.
It SEEMS like I ought to be able to do a substitution for the Block Elements range of glyphs like this:
<match>
<test name="charset" compare="eq">
<charset>
<range>
<int>0x2580</int>
<int>0x259F</int>
</range>
</charset>
</test>
<test name="family">
<family>IosevkaTerm</family>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>IBM 3270</string>
</edit>
</match>
...Right?
But it doesn't work.
There are other suggestions on StackExchange and Reddit, but... none of them work either.
Hrm...
If you happen to know the answer to this, message me.
Next: ...nothing! (yet)
Previous: [Q6T.0105] The Problem With Scattered Blocks
Tags: [#textgraphics] [#unix]